package com.ArrayList;

import java.util.ArrayList;
import java.util.Random;

/*
请随机生成1~100之间的10个整数，不能重复
*/
public class Demo06 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        Random r = new Random();
        while (true) {
            int rm = r.nextInt(10) + 1;
            if (!list.contains(rm)) {
                list.add(rm);
                if (list.size() == 10) {
                    break;
                }
            }
        }
        System.out.println(list);
    }
}
